package com.margo.project.automate;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import javax.tools.JavaCompiler;
import javax.tools.ToolProvider;

public class JavaCompilerTest {
	public static void main(String[] args) throws FileNotFoundException {
		//String fullQuanlifiedFileName = "compile" + java.io.File.separator + "Target.java";
		String fullQuanlifiedFileName="C:\\Users\\fangxingbang\\Desktop\\lcam\\punishnoticeitem\\dao\\SwPunishNoticeItemDAO.java";
		
		JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
		FileOutputStream err = new FileOutputStream("C:\\Users\\fangxingbang\\Desktop\\err.txt");
		int compilationResult = compiler.run(null, null, err, fullQuanlifiedFileName);
		if (compilationResult == 0) {
			System.out.println("Done");
		} else {
			System.out.println("Fail");
		}
	}
}
